package com.umgsai.thread.thread03;

public class PublicVar {
	private String username = "a";
	private String password = "aa";
	synchronized public void setValue(String username, String password){
		try {
			this.username = username;
			Thread.sleep(1000);
			this.password = password;
			System.out.println("setValue method, threadName=" + Thread.currentThread().getName());
			System.out.println("username=" + username + ", password=" + password);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	synchronized public void getValue() {
		System.err.println("getValue method, threadName=" + Thread.currentThread().getName());
		System.err.println("username=" + username + ", password=" + password);
	}
}
